package com.primestone.cim.client.app;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class ConsumeSysout {

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());
		final Text text = new Text(shell, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
		shell.open();

		OutputStream out = new OutputStream() {
			@Override
			public void write(int b) throws IOException {
				text.append(Character.toString((char) b));
			}
		};
		System.setOut(new PrintStream(out));

		System.out.println("Hello World!");
		
		//CallWS.doBusiness(5L, 1000L);

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}